<?
	class Login_model extends Model{
		function Login_model(){
			parent::Model();
		}
		
		function isValidLogin($username, $password){
			$this->db->select('*');
			$this->db->where('namauser', $username);
			$password = md5($password);
			$this->db->where('passwd', $password);
			$this->db->where('aktif', USER_AKTIF);
			$query = $this->db->get('user');
			if($query->num_rows() > 0) {
				return true;
			} else {
				return false;
			}
		}
        
        function getRole($username) {
            $this->db->select('id_grup');
            $this->db->where('namauser', $username);
            $query = $this->db->get('user');
            if($query->num_rows() > 0) {
                $row = $query->row();
                return $row->id_grup;
            } else {
                return false;
            }
        }
        
	}
?>